package com.bjpowernode.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class OneServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String result = "Hello World";
        PrintWriter out = resp.getWriter();
        out.write(result);


        // uri  是从url中截取的一个字符串
        /**
         *   格式  "/网站名/资源文件名"
         *   uri 用于让http服务器对被访问的资源文件进行定位
         * */
        String uri = req.getRequestURI(); // substring
        System.out.println(uri);
    }

}
